﻿using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using Application.Core.EntityService;
using Application.Core.ErrorHandlers;
using Domain.MainModule.Entities;
using Presentation.Web.Core.Pagination;

namespace Application.MainModule.DinnerManagement
{
    [ServiceContract]
    public interface IDinnerManagementService : IBaseService<Dinners,int>
    {
        [OperationContract()]
        [FaultContract(typeof(ApplicationServiceError))]
        [WebGet(UriTemplate = "FindUpcomingDinners", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
        IEnumerable<Dinners> FindUpcomingDinners();
        
        [OperationContract]
        [FaultContract(typeof(ApplicationServiceError))]
        [WebGet(UriTemplate = "GetMostPopularDinners?limit={limit}", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
        IEnumerable<Dinners> GetMostPopularDinners(int limit);


        [OperationContract]
        [FaultContract(typeof(ApplicationServiceError))]
        [WebGet(UriTemplate = "GetDinners?limit={limit}", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        GaryDTO GetDinners(int limit);

        [OperationContract]
        [WebGet(UriTemplate = "FindPagedDinners?pageNumner={pageNumner}&pageSize={pageSize}", BodyStyle = WebMessageBodyStyle.WrappedResponse, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]        
        IPagination<Dinners> FindPagedDinners(int pageNumner, int pageSize);
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "FindByLocation?latitude={latitude}&longitude={longitude}", BodyStyle = WebMessageBodyStyle.Bare)]
        IEnumerable<Dinners> FindByLocation(float latitude, float longitude);
        [OperationContract]
        IEnumerable<Dinners> FindDinnersByText(string q);
        [OperationContract]
        IEnumerable<Dinners> FindMyDinners(string userName);
        [OperationContract]
        Dinners FindDinner(int id);
        [OperationContract]
        void InsertOrUpdateDinner(Dinners dinner);
        [OperationContract]
        void DeleteDinner(int id);
        [OperationContract]
        void DeleteRSVP(RSVPs rsvp);
        [OperationContract]
        void Save();
    }
}
